import os


def start_redis():
    exec_command('redis-server &')


def start_python():
    exec_command('source /var/www/venv/bin/activate;cd /var/www/IPTVOPlatform;uwsgi --ini uwsgi.ini &')


def start_websoket():
    exec_command('source /var/www/venv/bin/activate;cd /var/www/IPTVOPlatform;daphne -b 127.0.0.1 -p 14100 IPTVOPlatform.asgi:application &')


def start_nginx():
    exec_command('systemctl restart nginx')


def exec_command(cmd):
    os.system(cmd)


def main():
    start_redis()
    start_python()
    start_websoket()
    start_nginx()


main()

